#ifndef __UTIL_H__
#define __UTIL_H__

#include "shyper_service.h"

#define INFO(args...)                                                          \
    do {                                                                       \
        pr_err("[Shyper MOD INFO] " args);                                                \
    } while (0)

#define WARNING(args...)                                                       \
    do {                                                                       \
        pr_err("[Shyper MOD WARNING] " args);                                             \
    } while (0)

#define ERROR(args...)                                                         \
    do {                                                                       \
        pr_err("[Shyper MOD ERROR] " args);                                               \
        while (1)                                                              \
            ;                                                                  \
    } while (0)

struct ring_queue {
    void *queue;
    u64 node_size;
    u64 node_num;
    u64 head;
    u64 tail;
};

struct ring_queue *queue_alloc(u64 node_size, u64 node_num);
void queue_push(struct ring_queue *ring_queue, void *node, u64 node_size);
void *queue_pop(struct ring_queue *ring_queue);
void queue_free(struct ring_queue *ring_queue);

u64 cal_page_size(u64 size, u64 index);

#endif